package com.example.yskjproject.adapter;

import android.annotation.SuppressLint;
import android.content.Context;

import androidx.annotation.Nullable;
import androidx.appcompat.widget.AppCompatTextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.example.yskjproject.R;
import com.example.yskjproject.model.CardModel;
import com.example.yskjproject.model.LeftMenuModel;

import java.util.List;

/**
 * TitleAdapter
 * <p>   显示标签
 * 作者：zx
 * 创建时间：2024/5/3
 */
public class TagAdapter extends BaseQuickAdapter<LeftMenuModel, BaseViewHolder> {
    Context context;
    public TagAdapter(Context context, @Nullable List<LeftMenuModel> data) {
        super(R.layout.item_tag, data);
        this.context = context;
    }

    @SuppressLint({"NewApi", "UseCompatLoadingForDrawables"})
    @Override
    protected void convert(BaseViewHolder helper, LeftMenuModel item) {
        AppCompatTextView tagContent = helper.getView(R.id.tag_content);
        helper.setText(R.id.tag_content,item.getName());
        helper.addOnClickListener(R.id.tag_content);
        if(item.isSelect()){
            tagContent.setBackground(context.getDrawable(R.drawable.tag_select_bg));
        }else {
            tagContent.setBackground(context.getDrawable(R.drawable.tag_bg));
        }
    }

}
